/*    */ package com.zimbra.cs.service.admin;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.AdminConstants;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.common.util.ZimbraLog;
/*    */ import com.zimbra.cs.account.AttributeManager;
/*    */ import com.zimbra.cs.account.Entry;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.accesscontrol.AdminRight;
/*    */ import com.zimbra.cs.account.accesscontrol.AttributeConstraint;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import java.util.ArrayList;
/*    */ import java.util.HashMap;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class ModifyDelegatedAdminConstraints
/*    */   extends AdminDocumentHandler
/*    */ {
/*    */   private static final String CONSTRAINT_ATTR = "zimbraConstraint";
/*    */   
/*    */   public Element handle(Element request, Map<String, Object> context)
/*    */     throws ServiceException
/*    */   {
/* 47 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/* 48 */     Provisioning prov = Provisioning.getInstance();
/*    */     
/* 50 */     Entry entry = GetDelegatedAdminConstraints.getEntry(request);
/*    */     
/* 52 */     AdminAccessControl.SetAttrsRight sar = new AdminAccessControl.SetAttrsRight();
/* 53 */     sar.addAttr("zimbraConstraint");
/* 54 */     checkRight(zsc, context, entry, sar);
/*    */     
/* 56 */     AttributeManager am = AttributeManager.getInstance();
/* 57 */     List<AttributeConstraint> constraints = new ArrayList();
/* 58 */     for (Element a : request.listElements("a")) {
/* 59 */       String attrName = a.getAttribute("name");
/* 60 */       Element eConstraint = a.getElement("constraint");
/*    */       
/* 62 */       constraints.add(AttributeConstraint.fromXML(am, attrName, eConstraint));
/*    */     }
/*    */     
/* 65 */     AttributeConstraint.modifyConstraint(entry, constraints);
/*    */     
/*    */ 
/* 68 */     Map<String, Object> attrs = new HashMap();
/* 69 */     attrs.put("zimbraConstraint", entry.getMultiAttr("zimbraConstraint", false));
/* 70 */     ZimbraLog.security.info(ZimbraLog.encodeAttrs(new String[] { "cmd", "ModifyDelegatedAdminConstraints", "name", entry.getLabel() }, attrs));
/*    */     
/*    */ 
/* 73 */     Element response = zsc.createElement(AdminConstants.MODIFY_DELEGATED_ADMIN_CONSTRAINTS_RESPONSE);
/* 74 */     return response;
/*    */   }
/*    */   
/*    */   public void docRights(List<AdminRight> relatedRights, List<String> notes)
/*    */   {
/* 79 */     notes.add("Need set attr right on attribute zimbraConstraint");
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/admin/ModifyDelegatedAdminConstraints.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */